package yto.freemarker.springcloud.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import yto.freemarker.springcloud.entity.User;

/**
 * @author dongxing
 * @create 2018-02-27 22:42
 **/
@Service
public class UserService {
    @Autowired
    private RestTemplate restTemplate;

    @Value("${service.user.url}")
    private String url;

    public User getUserById(Integer id) {
        User user = restTemplate.getForObject(this.url + id, User.class);
        return user;
    }
}
